/**
 * Created with IntelliJ IDEA.
 * Description: 不同路径的数目(一)
 * User: wangxin
 * Date: 2025-01-21
 * Time: 20:41
 */
public class Test {
    public int uniquePaths (int m, int n) {
        // write code here
        int[][] dp = new int[m+1][n+1];
        for(int i = 1;i <= m;i++){
            for(int j = 1;j <= n;j++){
                if(i -1 == 0||j-1==0){
                    dp[i][j] = 1;
                }else{
                    dp[i][j] = dp[i][j-1]+dp[i-1][j];
                }
            }

        }
        return dp[m][n];
    }
}
